/**
 * @param {number[]} nums1
 * @param {number[]} nums2
 * @return {number[]}
 */
 var intersection = function(nums1, nums2) {
  num1 = [... new Set(nums1)]
  num2 = [...new Set(nums2)]
  let result = []
    for(const num of num1){
      if(num2.includes(num)){
        result.push(num)
      }
    }
    return result
};
console.log(intersection([1,2,2,1], [2,2]));